package org.linlinjava.litemall.db.dao;

import java.util.List;

import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.linlinjava.litemall.db.domain.LitemallRechargeConsumption;
import org.linlinjava.litemall.db.domain.LitemallRechargeConsumptionExample;

public interface LitemallRechargeConsumptionMapper extends MPJBaseMapper<LitemallRechargeConsumption> {
    long countByExample(LitemallRechargeConsumptionExample example);

    int deleteByExample(LitemallRechargeConsumptionExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(LitemallRechargeConsumption record);

    int insertSelective(LitemallRechargeConsumption record);

    LitemallRechargeConsumption selectOneByExample(LitemallRechargeConsumptionExample example);

    LitemallRechargeConsumption selectOneByExampleSelective(@Param("example") LitemallRechargeConsumptionExample example, @Param("selective") LitemallRechargeConsumption.Column ... selective);

    List<LitemallRechargeConsumption> selectByExampleSelective(@Param("example") LitemallRechargeConsumptionExample example, @Param("selective") LitemallRechargeConsumption.Column ... selective);

    List<LitemallRechargeConsumption> selectByExample(LitemallRechargeConsumptionExample example);

    LitemallRechargeConsumption selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") LitemallRechargeConsumption.Column ... selective);

    LitemallRechargeConsumption selectByPrimaryKey(Integer id);

    LitemallRechargeConsumption selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);

    int updateByExampleSelective(@Param("record") LitemallRechargeConsumption record, @Param("example") LitemallRechargeConsumptionExample example);

    int updateByExample(@Param("record") LitemallRechargeConsumption record, @Param("example") LitemallRechargeConsumptionExample example);

    int updateByPrimaryKeySelective(LitemallRechargeConsumption record);

    int updateByPrimaryKey(LitemallRechargeConsumption record);

    int logicalDeleteByExample(@Param("example") LitemallRechargeConsumptionExample example);

    int logicalDeleteByPrimaryKey(Integer id);

    @Select("SELECT sum(amount) FROM litemall_recharge_consumption WHERE user_id = #{userId} and type = #{type}")
    Double getUserTopup(Integer userId,Byte type);
}
